$(function (){
    let vm = new Vue({
        el:'#goodList',
        data:{
            productList:[],
            imageWidth: 210, // 需要的宽度
            imageHeight: 200, // 需要的高度
        },
        methods:{
            goodDetail(id){
                $.post('../picture/getPictureList',{cid:id},function (res){
                    sessionStorage.setItem("good",JSON.stringify(res.data)) ;
                    window.location.href = '../shop.html'
                })
            }
        },
        computed: {
            imageStyle() {
                return {
                    width: `${this.imageWidth}px`,
                    height: `${this.imageHeight}px`,
                };
            }
        },
        beforeCreate(){
            $.post('../picture/getPictureLis',function (res){
                vm.productList = res.data;
            });
        }
    })

    $('#search').on('click',function (){
        let param = $('#key').val();
        if (param === ""){
            param = $('#key').attr('placeholder')
        }
        window.location.href = 'search.html?key='+param;
    })

    $('#login').on('click',function (){
        window.location.href = 'userInfologin.html';
    })
    $('#reg').on('click',function (){
        window.location.href = 'userInfologin.html';
    })
})